module.exports = {
  random(start, end) {
    return random(start, end);
  },
  randomS(min, max) {
    return random(min * 1000, max * 1000);
  },
  randomM(min, max) {
    return random(min * 60 * 1000, max * 60 * 1000);
  },
  getS(v) {
    return Math.floor(v / 1000);
  },
  getM(v) {
    return Math.floor(v / 60 / 1000);
  },
  hasExec(start) {
    var now = Date.now();
    return Math.floor((now - start) / 1000);
  },
  sleep(start, end) {
    var secs = this.random(start, end);
    sleep(secs * 1000);
    return secs;
  },
  sleepM(start, end) {
    var mn = this.random(start, end);
    sleep(mn * 60 * 1000);
    return mn;
  },
  getMin(sec) {
    return Math.floor(sec / 60);
  },
  possible(start, end, scale) {
    scale = scale || 100;
    var v = this.random(1, scale);
    return v >= start && v <= end;
  },
};
